<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="file" name="" id="file1">
    <input type="button" value="上传文件" id="btn1">
</body>
<script>
    let oFile=document.getElementById('file1');
    let oBtn=document.getElementById('btn1');

    oBtn.onclick=function(){
        let oAjax = new XMLHttpRequest();
        oAjax.open('POST','http://api.asshop.com/stock/imports',true);
        let fromData=new FormData();
        fromData.set('f1',oFile.files[0])
        oAjax.send(fromData)
        oAjax.onreadystatechange=function(){
            if(oAjax.readyState==4){
                alert(oAjax.status);
            }
        }
    }

</script>
</html>